Skip to content

feat: support gh CLI for authentication#2

Merged
rubysolo merged 2 commits intorubysolo:mainfrom
devgar:issue1-gh-token-comp
Feb 4, 2026
Merged

feat: support gh CLI for authentication#2
rubysolo merged 2 commits intorubysolo:mainfrom
devgar:issue1-gh-token-comp

Conversation

@devgar
Copy link
Contributor

@devgar devgar commented Feb 3, 2026

Improvements to authentication token retrieval:

  • Added a new utility function GetGHToken in util/github.go that first checks for the GITHUB_OAUTH_TOKEN environment variable, and if not found, attempts to retrieve the token using the GitHub CLI gh auth token. If both methods fail, it logs a clear error message and exits.
  • Updated the main application logic in brows.go to use the new util.GetGHToken function instead of directly reading the environment variable, improving robustness and user experience.

Documentation updates:

  • Updated the README.md to explain the new authentication method, clarifying that either the environment variable or the GitHub CLI can be used to provide the token.

fixes #1

@devgar devgar changed the title Get GH token using gh cli feat: possibility to take GitHub token form gh CLI Feb 3, 2026
@devgar devgar changed the title feat: possibility to take GitHub token form gh CLI feat: support gh CLI for authentication Feb 3, 2026
@rubysolo rubysolo requested a review from Copilot February 4, 2026 20:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances authentication handling by introducing a reusable GitHub token helper that falls back to the gh CLI, and updates the main CLI and docs to match.

Changes:

  • Added util.GetGHToken, which first reads GITHUB_OAUTH_TOKEN from the environment, then falls back to gh auth token, with clear fatal error messages if both fail.
  • Updated brows.go to use util.GetGHToken instead of directly reading the environment variable.
  • Updated README.md to document the new authentication behavior (env var or gh CLI).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
util/github.go Introduces GetGHToken helper to centralize token retrieval from env or gh CLI with validation and error messaging.
brows.go Wires main application logic to use util.GetGHToken and adds the corresponding import.
README.md Documents that brows will use GITHUB_OAUTH_TOKEN or fall back to gh auth token when available.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rubysolo rubysolo merged commit ecb4c5a into rubysolo:main Feb 4, 2026
6 checks passed
@rubysolo
Copy link
Owner

rubysolo commented Feb 4, 2026

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authentication detection using gh

2 participants